/*Main.java*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Main {

private static JFrame mainFrame = new JFrame();

private static int xRes = 1280;
private static int yRes = 800;

public static void MainMenu(){
mainFrame.setTitle("STOCK SIM");
mainFrame.setLocation(500, 300);
mainFrame.setSize(200, 75);
mainFrame.setVisible(true);
mainFrame.setResizable(false);

mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setLayout(new BorderLayout());

JPanel panel = new JPanel();
mainFrame.add(panel);

/* Adding Menu Buttons */
JButton playButton = new JButton("Play Game");

JButton exitButton = new JButton("Close");

panel.add(playButton);

panel.add(exitButton);

playButton.addActionListener (new playButton());

exitButton.addActionListener(new exitButton());
}

/* Actions for main menu buttons */
/* Starts up the simulator */
static class playButton implements ActionListener {
public void actionPerformed (ActionEvent e) {
mainFrame.removeAll();

mainFrame.setVisible(false);
mainFrame.dispose();
Game.initialize(xRes, yRes);
}

}

static class exitButton implements ActionListener {
public void actionPerformed (ActionEvent e) {
mainFrame.removeAll();
mainFrame.setVisible(false);
mainFrame.dispose();
}
}

public static void main (String[] args){
MainMenu();
}
}
